package main

import "fmt"

type MinStack struct {
	stackList    []int
	stackMinList []int
}

func Constructor() MinStack {
	return MinStack{}
}

func (this *MinStack) Push(val int) {
	this.stackList = append(this.stackList, val)
	if len(this.stackMinList) == 0 || this.GetMin() >= val {
		this.stackMinList = append(this.stackMinList, val)
	}
}

func (this *MinStack) Pop() {
	if this.GetMin() == this.Top() {
		this.stackMinList = this.stackMinList[:len(this.stackMinList)-1]
	}
	this.stackList = this.stackList[:len(this.stackList)-1]
}

func (this *MinStack) Top() int {
	return this.stackList[len(this.stackList)-1]
}

func (this *MinStack) GetMin() int {
	return this.stackMinList[len(this.stackMinList)-1]
}

/**
 * Your MinStack object will be instantiated and called as such:
 * obj := Constructor();
 * obj.Push(val);
 * obj.Pop();
 * param_3 := obj.Top();
 * param_4 := obj.GetMin();
 */

func main() {
	minStack := Constructor()
	minStack.Push(-2)
	minStack.Push(0)
	minStack.Push(-3)
	fmt.Println(minStack.GetMin())
	minStack.Pop()
	fmt.Println(minStack.Top())
	fmt.Println(minStack.GetMin())
}
